<?php

require_once "spElement.php";

/*
 $data = array(
	"content" 	: "yourContent",
	"value" 	: "yourValue",				// optional: 
	"selected" 	: "true"					// optional: true or false (default false) 
 )
 */

class spOption extends spElement
{
	public function __construct( $data=null )
	{
		parent::__construct( "option", $data );

		if ( isset($data["value"]) )
			parent::addAttr( "value", $data["value"] );
			
		if ( isset($data["selected"]) )
			parent::addAttr( "selected", "selected" );
	}
	
	public function getValue()
	{
		$data = parent::getData();
		if ( isset($data["value"]) )
			return $data["value"];
			
		return false;
	}
	
	public function setSelected( $bSelected )
	{
		if ( $bSelected )
			$this->addAttr( "selected", "selected" );
		else
			$this->removeAttr( "selected" );
	}
}

?>